let a;
let b = new Promise(resolve => {
  console.log(1);
  setTimeout(() => {
    resolve();
  }, 1000);
}).then(() => {
  console.log(2);
});

a = new Promise(async resolve => {
  console.log(a);
  await b; // 这里因为 await 了 所以 相当于 异步了 所以下面的a 不是undifined了
  console.log(a); // 这里a变成了 promise
  console.log(3);
  await a;
  resolve(true);
  console.log(4);
});
console.log(5);


// 转换一下

a = new Promise(async resolve => {
  console.log(a);
  b.then(async(resolve)=>{
    console.log(a); // 这里a变成了 promise
    console.log(3);
    await a;
    resolve(true);
    console.log(4);
  })
});
